/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin		 	*/
/*	Project:	GoLib-1.0.0			*/
/*	Author:		gong_libin			*/
/*	Date:		2016_01_01			*/
/*	File:		GoVecTest.go			*/
/********************************************************/

package main

import (
	. "GoGlb"
	C "GoCap"
)

func main() {
	v := new(C.GoVec)
	v.GoVecNew(30)
	for i := 0; i < 30; i ++ {
		v.GoVecAdd(i)
	}
	show(v.GoVecPtr())
	v.GoVecNil(15)
	show(v.GoVecPtr())
	v.GoVecSet(10, 20)
	show(v.GoVecPtr())
	GoPrtln("Pop:", v.GoVecPop())
	GoPrtln("Pop:", v.GoVecPop())
	GoPrtln("Pop:", v.GoVecPop())
	GoPrtln("Get:", v.GoVecGet(25))
	v.GoVecPut(5, 999)
	show(v.GoVecPtr())
	GoValOf("ValOf:", v)
}

func show(a interface{}) {
	for _, p := range a.([]interface{}) {
		if nil != p {
			GoPrint("%d, ", p)
		} else {
			GoPrint("<nil> ")
		}
	}
	GoPrtln()
}
